# 方式2：
FROM golang:1.14.1-alpine AS build
ADD v0.2.1.tar.gz /root
RUN cd /root/mm-wiki-0.2.1; \
  go env -w GO111MODULE=on;\
  go env -w GOPROXY=https://goproxy.cn,direct; \
  go build -o ./mm-wiki .

FROM alpine:latest
COPY --from=build /root/mm-wiki-0.2.1/conf /opt/mm-wiki/conf
COPY --from=build /root/mm-wiki-0.2.1/install /opt/mm-wiki/install
COPY --from=build /root/mm-wiki-0.2.1/mm-wiki /opt/mm-wiki/mm-wiki
COPY --from=build /root/mm-wiki-0.2.1/scripts/run.sh /opt/mm-wiki/scripts/run.sh
COPY --from=build /root/mm-wiki-0.2.1/static /opt/mm-wiki/static
COPY --from=build /root/mm-wiki-0.2.1/views /opt/mm-wiki/views
COPY --from=build /root/mm-wiki-0.2.1/logs /opt/mm-wiki/logs
COPY --from=build /root/mm-wiki-0.2.1/docs /opt/mm-wiki/docs
ENV TZ=Asia/Shanghai
WORKDIR /opt/mm-wiki
CMD ["/opt/mm-wiki/mm-wiki", "--conf", "/opt/mm-wiki/conf/mm-wiki.conf"]
